package recharge_management

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/rpc-client/assetsClient/rpc"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type RechargeVipLevelCreateLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// NewRechargeVipLevelCreateLogic VIP充值等级--新增
func NewRechargeVipLevelCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RechargeVipLevelCreateLogic {
	return &RechargeVipLevelCreateLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RechargeVipLevelCreateLogic) RechargeVipLevelCreate(req *types.RechargeVipLevelCreateRequest) (resp *types.CommonResponse, err error) {
	in := rpc.RechargeVipLevelCreateRequest{
		Level:  req.Level,
		Times:  req.Times,
		Amount: req.Amount,
	}
	_, err = l.svcCtx.AssetsRpc.PayRecharge.RechargeVipLevelCreate(l.ctx, &in)
	if err != nil {
		return nil, err
	}

	return &types.CommonResponse{
		CommonResp: types.CommonResp{
			Code:    0,
			Message: "Success",
		},
	}, nil
}
